<?php
/**
 * Created by PhpStorm.
 * User: mzh03@163.com
 * Date: 2016/8/25
 * Time: 下午 05:28
 */


namespace Admin\Controller;
use Common\Controller\AdminBaseController;

class RegionController extends AdminBaseController {

    //区域列表
    public function index(){
        $data=D('Region')->select();
        $assign=array(
            'data'=>$data
        );
        $this->assign($assign);
        $this->display();
    }

    //区域添加
    public function add(){
        $data=I('post.');
        D('Region')->addData($data);
        $this->success('添加成功',U('Admin/Region/index'));
    }

    //删除区域
    public function delete(){
        $id=I('get.id');
        $map=array(
            'id'=>$id
        );
        D('Region')->deleteData($map);
        $this->success('删除成功',U('Admin/Region/index'));
    }

    /**
     * 修改区域
     */
    public function edit(){
        $data=I('post.');
        $map=array(
            'id'=>$data['id']
        );
        D('Region')->editData($map,$data);
        $this->success('修改成功',U('Admin/Region/index'));
    }
}